from django.shortcuts import render

# Create your views here.

ls = []


def login_view(request):
    md = request.method
    if md == "GET":
        return render(request, 'login.html')
    elif md == "POST":
        username = request.POST.get('username', '')
        password = request.POST.get('password', '')
        if username == ls[0] and password == ls[1]:
            return render(request, 'loginSucceed.html')
        else:
            return render(request, 'login.html')


def register_view(request):
    md = request.method
    if md == "GET":
        return render(request, 'register.html')
    elif md == "POST":
        username1 = request.POST.get('username1', '')
        password1 = request.POST.get('password1', '')
        ls.append(username1)
        ls.append(password1)
        if username1 == "" or password1 == "":
            return render(request, 'register.html')
        else:
            return render(request, 'registerSucceed.html')

def index_view(request):
    return render(request, 'index.html')